/**sigqueue receive signal*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
#include<signal.h>

static void sig_handler(int sig,siginfo_t *info,void *context){
	sigval_t sig_val=info->si_value;
	printf("receive rtsignal:%d\n",sig);
	printf("data:%d\n",sig_val.sival_int);
	printf("PID:%d\n",info->si_pid);
	printf("UID:%d\n",info->si_uid);
	exit(0);
}

int main(int argc,char **argv)
{
	printf("14_test start\n");
	struct sigaction sig={0};
	int num;
	if(2>argc)
		exit(-1);
	num=atoi(argv[1]);
	sig.sa_sigaction=sig_handler;
	sig.sa_flags=SA_SIGINFO;
	if(-1==sigaction(num,&sig,NULL)){
		perror("sigaction error");
		exit(-1);
	}
	for(;;)
		sleep(1);
	puts("14_test end");
	return 0;
}
